const $=(function(){
    function creatXHR(){
        if(window.XMLHttpRequest){
            return new XMLHttpRequest();
        }
        return new ActiveXObject("Msxml2.XMLHTTP");
    }

    function ajax(url,callback){
        let xhr=creatXHR();
        xhr.open("get",url,true);
        xhr.send(null);

        xhr.onreadystatechange=function(){
            if(xhr.status==200){
                if(xhr.readyState==4){
                    callback(xhr.response);
                }
            }
        }
    }
    return{
        ajax
    }
})()